package 常用类.math运算;

public class math01 {
    public static void main(String[] args) {
        //abs 绝对值
        int abs = Math.abs(-9);
        System.out.println(abs);
        //pow 求幂
        double pow = Math.pow(2, 4);
        System.out.println(pow);
        //ceil 向上取整
        double ceil = Math.ceil(4.9);
        double ceil1 = Math.ceil(-4.9);
        System.out.println(ceil);
        System.out.println(ceil1);
        //floor 向下取整
        double floor = Math.floor(4.1);
        double floor1 = Math.floor(-4.8);
        System.out.println(floor1);
        System.out.println(floor);
        //round 四舍五入
        long round = Math.round(4.456);
        System.out.println(round);
        //sqrt 求开方
        double sqrt = Math.sqrt(9);
        System.out.println(sqrt);
        //random 随机数 返回0~1之间的一个随机小数
        for (int i = 0; i < 10; i++) {
            System.out.println(Math.random());
        }
    }
}
